package com.projectexercise.book.configurations;

import com.projectexercise.book.model.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
@Slf4j
@ControllerAdvice
@ResponseBody
public class ExceptionAdvice {
    @ExceptionHandler
    public Result<Object> handler(Exception e){
        log.error("异常信息 e: " + e);
        return Result.fail("内部错误");
    }
}
